﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PlanningGIS.Engine.Controls
{
    /// <summary>
    /// 
    /// </summary>
    public partial class ColorCreator : UserControl
    {
        /// <summary>
        /// 
        /// </summary>
        public ColorCreator()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 
        /// </summary>
        public event ColorSelectedEvent SelectChanged = null;

        /// <summary>
        /// 
        /// </summary>
        public Color SelectedColor
        {
            get { return btnColor.SymbolColor; }
            set { btnColor.SymbolColor = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void flyout_FlyoutShown(object sender, EventArgs e)
        {
            styleColor1.SelectedColor = btnColor.SymbolColor;
            styleColor1.Init();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void styleColor1_SelectChanged(object sender, ColorEventArgs e)
        {
            btnColor.SymbolColor = e.NewColor;
            flyout.Close();
            SelectChanged?.Invoke(this, new ColorEventArgs()
            {
                NewColor = btnColor.SymbolColor
            });
        }

        
    }
    
}
